Optimal. Leaf size=191 \[ -\frac {(-3 B+i A) \tan ^2(c+d x)}{2 d \left (a^3+i a^3 \tan (c+d x)\right )}+\frac {(7 A+25 i B) \tan (c+d x)}{8 a^3 d}-\frac {(-3 B+i A) \log (\cos (c+d x))}{a^3 d}-\frac {x (7 A+25 i B)}{8 a^3}+\frac {(-B+i A) \tan ^4(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(5 A+11 i B) \tan ^3(c+d x)}{24 a d (a+i a \tan (c+d x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.47, antiderivative size = 191, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 3, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {3595, 3525, 3475} \[ -\frac {(-3 B+i A) \tan ^2(c+d x)}{2 d \left (a^3+i a^3 \tan (c+d x)\right )}+\frac {(7 A+25 i B) \tan (c+d x)}{8 a^3 d}-\frac {(-3 B+i A) \log (\cos (c+d x))}{a^3 d}-\frac {x (7 A+25 i B)}{8 a^3}+\frac {(-B+i A) \tan ^4(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(5 A+11 i B) \tan ^3(c+d x)}{24 a d (a+i a \tan (c+d x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3525
Rule 3595
Rubi steps
\begin {align*} \int \frac {\tan ^4(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^3} \, dx &=\frac {(i A-B) \tan ^4(c+d x)}{6 d (a+i a \tan (c+d x))^3}-\frac {\int \frac {\tan ^3(c+d x) (4 a (i A-B)+a (A+7 i B) \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx}{6 a^2}\\ &=\frac {(i A-B) \tan ^4(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(5 A+11 i B) \tan ^3(c+d x)}{24 a d (a+i a \tan (c+d x))^2}+\frac {\int \frac {\tan ^2(c+d x) \left (-3 a^2 (5 A+11 i B)+3 a^2 (3 i A-13 B) \tan (c+d x)\right )}{a+i a \tan (c+d x)} \, dx}{24 a^4}\\ &=\frac {(i A-B) \tan ^4(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(5 A+11 i B) \tan ^3(c+d x)}{24 a d (a+i a \tan (c+d x))^2}-\frac {(i A-3 B) \tan ^2(c+d x)}{2 d \left (a^3+i a^3 \tan (c+d x)\right )}-\frac {\int \tan (c+d x) \left (-48 a^3 (i A-3 B)-6 a^3 (7 A+25 i B) \tan (c+d x)\right ) \, dx}{48 a^6}\\ &=-\frac {(7 A+25 i B) x}{8 a^3}+\frac {(7 A+25 i B) \tan (c+d x)}{8 a^3 d}+\frac {(i A-B) \tan ^4(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(5 A+11 i B) \tan ^3(c+d x)}{24 a d (a+i a \tan (c+d x))^2}-\frac {(i A-3 B) \tan ^2(c+d x)}{2 d \left (a^3+i a^3 \tan (c+d x)\right )}+\frac {(i A-3 B) \int \tan (c+d x) \, dx}{a^3}\\ &=-\frac {(7 A+25 i B) x}{8 a^3}-\frac {(i A-3 B) \log (\cos (c+d x))}{a^3 d}+\frac {(7 A+25 i B) \tan (c+d x)}{8 a^3 d}+\frac {(i A-B) \tan ^4(c+d x)}{6 d (a+i a \tan (c+d x))^3}+\frac {(5 A+11 i B) \tan ^3(c+d x)}{24 a d (a+i a \tan (c+d x))^2}-\frac {(i A-3 B) \tan ^2(c+d x)}{2 d \left (a^3+i a^3 \tan (c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 7.26, size = 1251, normalized size = 6.55 \[ \frac {\sec ^3(c+d x) (-B \cos (3 c-d x)+B \cos (3 c+d x)-i B \sin (3 c-d x)+i B \sin (3 c+d x)) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{2 d \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3}+\frac {x \sec ^2(c+d x) \left (-\frac {1}{2} A \cos ^3(c)-\frac {3}{2} i B \cos ^3(c)-2 i A \sin (c) \cos ^2(c)+6 B \sin (c) \cos ^2(c)+3 A \sin ^2(c) \cos (c)+9 i B \sin ^2(c) \cos (c)+\frac {1}{2} A \cos (c)+\frac {3}{2} i B \cos (c)+2 i A \sin ^3(c)-6 B \sin ^3(c)+i A \sin (c)-3 B \sin (c)-\frac {1}{2} A \sin ^3(c) \tan (c)-\frac {3}{2} i B \sin ^3(c) \tan (c)-\frac {1}{2} A \sin (c) \tan (c)-\frac {3}{2} i B \sin (c) \tan (c)+i (A+3 i B) (\cos (3 c)+i \sin (3 c)) \tan (c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{(A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3}+\frac {(11 A+23 i B) \cos (2 d x) \sec ^2(c+d x) \left (\frac {1}{16} i \cos (c)-\frac {\sin (c)}{16}\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3}+\frac {(7 B-5 i A) \cos (4 d x) \sec ^2(c+d x) \left (\frac {\cos (c)}{32}-\frac {1}{32} i \sin (c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3}+\frac {\sec ^2(c+d x) \left (-i A \cos \left (\frac {3 c}{2}\right )+3 B \cos \left (\frac {3 c}{2}\right )+A \sin \left (\frac {3 c}{2}\right )+3 i B \sin \left (\frac {3 c}{2}\right )\right ) \left (\cos \left (\frac {3 c}{2}\right ) \log (\cos (c+d x))+i \sin \left (\frac {3 c}{2}\right ) \log (\cos (c+d x))\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3}+\frac {(A+i B) \cos (6 d x) \sec ^2(c+d x) \left (\frac {1}{48} i \cos (3 c)+\frac {1}{48} \sin (3 c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3}+\frac {(7 A+25 i B) \sec ^2(c+d x) \left (-\frac {1}{8} d x \cos (3 c)-\frac {1}{8} i d x \sin (3 c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3}+\frac {(11 A+23 i B) \sec ^2(c+d x) \left (\frac {\cos (c)}{16}+\frac {1}{16} i \sin (c)\right ) \sin (2 d x) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3}+\frac {(5 A+7 i B) \sec ^2(c+d x) \left (\frac {1}{32} i \sin (c)-\frac {\cos (c)}{32}\right ) \sin (4 d x) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3}+\frac {(A+i B) \sec ^2(c+d x) \left (\frac {1}{48} \cos (3 c)-\frac {1}{48} i \sin (3 c)\right ) \sin (6 d x) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^3}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^3} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.82, size = 173, normalized size = 0.91 \[ -\frac {12 \, {\left (15 \, A + 49 i \, B\right )} d x e^{\left (8 i \, d x + 8 i \, c\right )} + {\left (12 \, {\left (15 \, A + 49 i \, B\right )} d x - 66 i \, A + 330 \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} - {\left (51 i \, A - 117 \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} - {\left (-13 i \, A + 19 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - {\left ({\left (-96 i \, A + 288 \, B\right )} e^{\left (8 i \, d x + 8 i \, c\right )} + {\left (-96 i \, A + 288 \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 i \, A + 2 \, B}{96 \, {\left (a^{3} d e^{\left (8 i \, d x + 8 i \, c\right )} + a^{3} d e^{\left (6 i \, d x + 6 i \, c\right )}\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 1.92, size = 144, normalized size = 0.75 \[ \frac {\frac {6 \, {\left (i \, A + B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{3}} - \frac {6 \, {\left (-15 i \, A + 49 \, B\right )} \log \left (i \, \tan \left (d x + c\right ) + 1\right )}{a^{3}} + \frac {96 i \, B \tan \left (d x + c\right )}{a^{3}} - \frac {165 i \, A \tan \left (d x + c\right )^{3} - 539 \, B \tan \left (d x + c\right )^{3} + 291 \, A \tan \left (d x + c\right )^{2} + 1245 i \, B \tan \left (d x + c\right )^{2} - 171 i \, A \tan \left (d x + c\right ) + 981 \, B \tan \left (d x + c\right ) - 29 \, A - 259 i \, B}{a^{3} {\left (\tan \left (d x + c\right ) - i\right )}^{3}}}{96 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.19, size = 219, normalized size = 1.15 \[ \frac {i B \tan \left (d x +c \right )}{d \,a^{3}}+\frac {B \ln \left (\tan \left (d x +c \right )+i\right )}{16 d \,a^{3}}+\frac {i A \ln \left (\tan \left (d x +c \right )+i\right )}{16 d \,a^{3}}-\frac {A}{6 d \,a^{3} \left (\tan \left (d x +c \right )-i\right )^{3}}-\frac {i B}{6 d \,a^{3} \left (\tan \left (d x +c \right )-i\right )^{3}}-\frac {49 \ln \left (\tan \left (d x +c \right )-i\right ) B}{16 d \,a^{3}}+\frac {15 i \ln \left (\tan \left (d x +c \right )-i\right ) A}{16 d \,a^{3}}+\frac {17 A}{8 d \,a^{3} \left (\tan \left (d x +c \right )-i\right )}+\frac {31 i B}{8 d \,a^{3} \left (\tan \left (d x +c \right )-i\right )}+\frac {7 i A}{8 d \,a^{3} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {9 B}{8 d \,a^{3} \left (\tan \left (d x +c \right )-i\right )^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.76, size = 184, normalized size = 0.96 \[ \frac {\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {B\,7{}\mathrm {i}}{2\,a^3}+\frac {\left (-3\,B+A\,1{}\mathrm {i}\right )\,27{}\mathrm {i}}{8\,a^3}\right )+\frac {4\,B}{3\,a^3}-{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {5\,B}{2\,a^3}+\frac {17\,\left (-3\,B+A\,1{}\mathrm {i}\right )}{8\,a^3}\right )+\frac {17\,\left (-3\,B+A\,1{}\mathrm {i}\right )}{12\,a^3}}{d\,\left (-{\mathrm {tan}\left (c+d\,x\right )}^3\,1{}\mathrm {i}-3\,{\mathrm {tan}\left (c+d\,x\right )}^2+\mathrm {tan}\left (c+d\,x\right )\,3{}\mathrm {i}+1\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )}{16\,a^3\,d}+\frac {B\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}{a^3\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-49\,B+A\,15{}\mathrm {i}\right )}{16\,a^3\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 1.57, size = 342, normalized size = 1.79 \[ - \frac {2 B}{a^{3} d e^{2 i c} e^{2 i d x} + a^{3} d} + \begin {cases} - \frac {\left (\left (- 512 i A a^{6} d^{2} e^{6 i c} + 512 B a^{6} d^{2} e^{6 i c}\right ) e^{- 6 i d x} + \left (3840 i A a^{6} d^{2} e^{8 i c} - 5376 B a^{6} d^{2} e^{8 i c}\right ) e^{- 4 i d x} + \left (- 16896 i A a^{6} d^{2} e^{10 i c} + 35328 B a^{6} d^{2} e^{10 i c}\right ) e^{- 2 i d x}\right ) e^{- 12 i c}}{24576 a^{9} d^{3}} & \text {for}\: 24576 a^{9} d^{3} e^{12 i c} \neq 0 \\x \left (- \frac {- 15 A - 49 i B}{8 a^{3}} - \frac {i \left (- 15 i A e^{6 i c} + 11 i A e^{4 i c} - 5 i A e^{2 i c} + i A + 49 B e^{6 i c} - 23 B e^{4 i c} + 7 B e^{2 i c} - B\right ) e^{- 6 i c}}{8 a^{3}}\right ) & \text {otherwise} \end {cases} - \frac {x \left (15 A + 49 i B\right )}{8 a^{3}} - \frac {i \left (A + 3 i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a^{3} d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________